<?
if (!$isInstallProgram)
	exit;
?>

<table width='100%' align='center'><tr><td>

<form method="POST" action="install.php">
<input type="hidden" name="level" value="3">

<b>MySQL Tables Configuration & File Configuration</b><br />
<br />

<?
require ("admin/adm_set_fill.php");
$set_mysql_host=getParam("set_mysql_host","");
$set_mysql_base=getParam("set_mysql_base","");
$set_mysql_user=getParam("set_mysql_user","");
$set_mysql_pass=getParam("set_mysql_pass","");

echo "<input type='hidden' name='set_mysql_host' value='$set_mysql_host'>";
echo "<input type='hidden' name='set_mysql_base' value='$set_mysql_base'>";
echo "<input type='hidden' name='set_mysql_user' value='$set_mysql_user'>";
echo "<input type='hidden' name='set_mysql_pass' value='$set_mysql_pass'>";

$res_conn = mysql_connect ($set_mysql_host,$set_mysql_user,$set_mysql_pass);
$res_sel = mysql_select_db ($set_mysql_base);
$result = mysql_list_tables($set_mysql_base);



while ($row=mysql_fetch_array($result))
{
	$lArray[]=$row[0];	
}

$lShow=1;
$lDir=getParam("set_path",getPATH());
$lUrl=getParam("set_url",getURL());
$lEmail=getParam("set_webmaster_address","");
$set_table_prefix=getParam("set_table_prefix","");
$lUrl=eregi_replace("http://","",$lUrl);

if (getParam("submit",""))
{
	$fp=fopen("admin/config/gen_inc.php","w+");
	$confstr.="$" . "set_path=\"$lDir\";\n";
	$confstr.="$" . "set_url=\"$lUrl\";\n";
	$confstr.="$" . "set_webmaster_address=\"$lEmail\";\n";
	$confstr.="$" . "set_chmod=\"$chmod\";\n";
	$confstr.="$" . "set_table_prefix=\"$set_table_prefix\";\n";
	$confstr.="$" . "set_mysql_host=\"$set_mysql_host\";\n";
	$confstr.="$" . "set_mysql_base=\"$set_mysql_base\";\n";
	$confstr.="$" . "set_mysql_user=\"$set_mysql_user\";\n";
	$confstr.="$" . "set_mysql_pass=\"$set_mysql_pass\";\n";
	$confstr.="$" . "set_language=\"eng\";\n";
	
	fwrite($fp,"<?\n" . $confstr . "\n?>");
	@chmod("admin/config/gen_inc.php",octdec($chmod));
	
	require("db_sync.php");	
	echo "<p>If you did not recieve any error messages above, everything is OK!</p>";
	print("<center><h3><a href='install.php?level=4'><img src='layout_images/arrow-forw.gif' border='0'> <u>Next Step</u></a></h3></center></center>");
	$lShow=0;
	
	
}


if ($lShow==1)
{



echo "<p><b>Path to program</b><br>";
echo "<input type='text' size='50' name='set_path' value='".getPATH()."'></p>";

echo "<p><b>URL to program</b> (no http:// and no trailing slash!)<br>";
echo "<input type='text' size='50' name='set_url' value='".getURL()."'></p>";

echo "<p><b>Your Email Address</b><br>";
echo "<input type='text' size='50' name='set_webmaster_address' value='@'></p>";

echo "<p><b>Table prefix</b><br>";
echo "<input type='text' size='50' name='set_table_prefix' value='phpclass_'></p>";


echo "<input type='submit' class='whitebtn' value='Create' name='submit'></form>";
}
?>

</td></tr></table>

